import {MissonModel} from '@/mount/room/Misson/missonModel'
/* 建筑任务 */
export default class StructureTask extends Room {
    /* 资源点链接传送任务监控 */
    public SLToCL_PAS():void{
        if (Game.time % 4) return
        if (this.CheckMissonNum('STRUCTURE',"链传送能") > 3) return
        if (!this.memory.TaskMemory.source_link) return
        var source_link = Game.getObjectById(this.memory.TaskMemory.source_link as string) as StructureLink
        var source2_link:StructureLink
        if (this.memory.TaskMemory.source2_link)
        {
            source2_link = Game.getObjectById(this.memory.TaskMemory.source2_link as string) as StructureLink
        }
        else
            source2_link = null
        
        if (!this.memory.TaskMemory.center_link) return
        if (!source_link) return
        if (source_link.store.getUsedCapacity('energy') >= 400)
        {
            let thisTask:RoomTask = {} as RoomTask
            Object.assign(thisTask,MissonModel['链传送能'])
            let center_link = Game.getObjectById(this.memory.TaskMemory.center_link as string) as StructureLink
            if (!center_link) {delete this.memory.TaskMemory.center_link;return}
            thisTask.disStructure = [center_link.id]
            thisTask.relateStructure = [source_link.id]
            this.mountMisson(thisTask)
        }
        if (!source2_link) return
        if (source2_link.store.getUsedCapacity('energy') >= 400)
        {
            let thisTask:RoomTask = {} as RoomTask
            Object.assign(thisTask,MissonModel['链传送能'])
            let center_link = Game.getObjectById(this.memory.TaskMemory.center_link as string) as StructureLink
            if (!center_link) {delete this.memory.TaskMemory.center_link;return}
            thisTask.disStructure = [center_link.id]
            thisTask.relateStructure = [source2_link.id]
            this.mountMisson(thisTask)
        }
        
    }

    /* 实验室boost任务主动处理 */
    
}